<style>
    .font-icon {
        width: 12px;
        display: inline-block;
        line-height: 40px;
        height: 40px;
        float: left;
        margin-right: 10px;
        margin-left: 30px;
    }
</style>
<div class="main-layout-side">
    <div class="m-logo">
    </div>
    <ul class="layui-nav layui-nav-tree" lay-filter="leftNav">
        @foreach($menus as $menu)
            @if(!$menu->children->isEmpty())
                <li class="layui-nav-item">
                    <a href="javascript:void(0);" data-url="@if($menu->pid == 1){{route($menu->label)}} @endif"
                       data-id='{{$menu->id}}'
                       data-text="{{$menu->name}}"><i class="{!! $menu->icon !!}"></i><span>
                                        &nbsp;
                                    </span>{{$menu->name}}
                    </a>
                    <dl class="layui-nav-child">
                        @foreach($menu->children as $children)
                            <dd><a href="javascript:void(0);"
                                   data-url="@if($children->pid == 1){{route($children->label)}} @endif"
                                   data-id='{{$children->id}}'
                                   data-text="{{$children->name}}">
                                    @if($children->icon)
                                        <i class="{!! $children->icon !!} font-icon"></i>
                                    @else
                                        <span class="l-line"></span>
                                    @endif
                                    <span>
                                        &nbsp;
                                    </span>
                                    {{$children->name}}</a></dd>
                        @endforeach
                    </dl>
                </li>
            @else
                <li class="layui-nav-item">
                    <a href="javascript:void(0);" data-url="@if($menu->pid == 1){{route($menu->label)}} @endif"
                       data-id='{{$menu->id}}'
                       data-text="{{$menu->name}}"><i class="{!! $menu->icon !!}"></i><span>
                                        &nbsp;
                                    </span>{{$menu->name}}
                    </a>
                </li>
            @endif
        @endforeach
    </ul>
</div>
